/**
 * 新闻列表
 */
$(function(){
	var schoolId = $("#search-schoolId").find("option:selected").val();
	if(schoolId != null && schoolId != ''){
		var teamId = $("#Team").val();
		$.ajax({
            url:'/team/queryTeamBySchoolId.json?schoolId='+ schoolId,
            type:'POST',
            dataType:"json",
            success:function(date) {
                var optionStr = "<option value=''>--球队--</option>";
                $(date).each(function(i,obj){
                	if(teamId == obj.id){
                		optionStr += "<option value='"+obj.id+"' selected='selected'>"+obj.name+"</option>";
                	}else{
                		optionStr += "<option value='"+obj.id+"'>"+obj.name+"</option>";
                	}
                });
                $("#search-teamId").empty().append(optionStr);
            }
        });
	}
	$("#search-schoolId").change(function(){
		var schoolId = $(this).find("option:selected").val();
		if(schoolId != null && schoolId != ''){
			$.ajax({
	            url:'/team/queryTeamBySchoolId.json?schoolId='+ schoolId,
	            type:'POST',
	            dataType:"json",
	            success:function(date) {
	                var optionStr = "<option value=''>--球队--</option>";
	                $(date).each(function(i,obj){
	                	optionStr += "<option value='"+obj.id+"'>"+obj.name+"</option>";
	                });
	                $("#search-teamId").empty().append(optionStr);
	            }
	        });
		}else{
			$("#search-teamId").empty().append("<option value=''>--球队--</option>");
		}
	});
});